# OddEvenEncryption_v1.py # # Description: Write a program that encrypts and decrypts messages # using a transposition algorithm called "odd&even". # # Anne Lavergne # Date: Feb. 2 2024 # Ask the user for a message to encrypt/decrypt plainMsg = input("Please, enter a message to encrypt/decrypt: ") # ***Encryption*** # Create two empty strings strOfOddChars = "" strOfEvenChars = "" # Consider the index of each character in the user's plain message for index in range(len(plainMsg)): # If index of character is odd if index % 2 == 1: # Put this character in strOfOddChars strOfOddChars += plainMsg[index] else: # Otherwise put it in strOfEvenChars strOfEvenChars += plainMsg[index] # When finish, create the cipher cipherMsg = strOfOddChars + strOfEvenChars # Print the cipherMsg, i.e., the encrypted user message print(f'''\nThe original plain message you entered was "{plainMsg}". Once encrypted, your message looked like this "{cipherMsg}".''')